<template>
	<view style="padding: 20rpx;">
		<view>
			<view>
				<view class="box" v-for="item in businessList" :key="item.id"
					style="margin-bottom: 20rpx;" >
					<view style="display: flex;grid-gap: 30rpx;margin-bottom: 10rpx;" @click="goToDetail(item.id)">
						<view style="width: 30%;">
							<image :src="item.avatar" style="width:100%;border-radius: 10rpx;height: 200rpx;display: block;"></image>
						</view>
						<view style="flex: 1;display: flex;flex-direction: column;justify-content: space-between;grid-gap: 10rpx;">
							<view style="font-size: 36rpx;font-weight: bold;">
								{{item.name}}
							</view>
							<view style="display: flex;color: #666;">
								<view style="flex: 1;">
									<text style="color: #ff9800;font-size: bold;">{{item.score}}分</text>
									<text style="margin-left: 10rpx;">已售{{item.nums}}</text>
								</view>
								<view style="flex: 1;text-align: right;">
									30分钟内送达
								</view>
							</view>
							<view style="color: #ff9800;">
								免配送费
							</view>
							<view style="background-color: #ffd281; color: brown; border-radius: 4rpx;width: fit-content;padding: 0 8rpx;">{{item.info||'商家介绍'}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				type:'',
				businessList:[],
			}
		},
		onLoad(option){
			this.type=option.type
			this.load()
		},
		methods: {
			goToDetail(businessId){
				uni.navigateTo({
					url:'/pages/detail/detail?businessId='+businessId
				})
			},
			load(){
				// 获取商家信息
				this.$request.get('/business/selectAll', {type: this.type,status:'通过'}).then(res => {
					if (res.code === '200') {
						this.businessList = res.data || []
					}
				})
			}
		}
	}
</script>

<style scoped>

</style>
